/**
 * verification 规则校验逻辑
 * submit 提交接口：循环列表数据字段校验逻辑
 * FormData 整合所有数据
 **/
export default {

	methods: {
		verification() { //根据配置校验
			let that = this
			let RulesArr = Object.keys(getApp().globalData.rules)
			let Rules = getApp().globalData.rules
			let FormData = this.FormData()

			let flag = 0
			let sceneType = getApp().globalData.stdOffsurBaiscInfo.sceneType //场景选择
			let industry = getApp().globalData.stdOffsurEntBasic.industry //行业

			//根据场景判断必填规则
			// 1>商用车：自然人：经营主体，行业，财务为非必填 企业：经营主体为必填，行业情况，财务为非必填
			// 2>雅斯特，海吉星 经营主体为必填，行业情况，财务为非必填
			// 3>不选，经营主体，行业，财务为必填
			// 4》无场景
			// 5,通用场景
			//
			//通用场景 经营历史必填
			if (sceneType == '5') {
				Rules.stdOffsurLoanBasic = {
					loanUse: {
						msg: '不能为空',
						tName: 'loanUse',
						tId: '4'
					},
					useDetail: {
						msg: '不能为空',
						tName: 'loanUse',
						tId: '4'
					},
				}
				Rules.stdOffsurColonyInfo = {
					productCode: {
						msg: '不能为空',
						tName: 'colony',
						tId: '1'
					},
					colonyCode: {
						msg: '不能为空',
						tName: 'colony',
						tId: '1'
					},
					partnerCode: {
						msg: '不能为空',
						tName: 'colony',
						tId: '1'
					},
					isGuarantee: {
						msg: '不能为空',
						tName: 'colony',
						tId: '1'
					},
					marks: {
						msg: '不能为空',
						tName: 'colony',
						tId: '1'
					},
				}

			} else if (sceneType == '4') {
				if (getApp().globalData.isProject) { //是否专案
					Rules.stdOffsurColonyInfo = {
						productCode: {
							msg: '不能为空',
							tName: 'colony',
							tId: '1'
						},
						colonyCode: {
							msg: '不能为空',
							tName: 'colony',
							tId: '1'
						},
						partnerCode: {
							msg: '不能为空',
							tName: 'colony',
							tId: '1'
						},
						isGuarantee: {
							msg: '不能为空',
							tName: 'colony',
							tId: '1'
						},
					}

				} else {
					Rules.stdOffsurColonyInfo = {
						productCode: {
							msg: '不能为空',
							tName: 'colony',
							tId: '1'
						},
					}

				}

				Rules.stdOffsurLoanBasic = {
					loanUse: {
						msg: '不能为空',
						tName: 'loanUse',
						tId: '4'
					},
					
					useDetail: {
						msg: '不能为空',
						tName: 'loanUse',
						tId: '4'
					},
				}

			} else {
				Rules.stdOffsurColonyInfo = {
					productCode: {
						msg: '不能为空',
						tName: 'colony',
						tId: '1'
					},
					colonyCode: {
						msg: '不能为空',
						tName: 'colony',
						tId: '1'
					},
					partnerCode: {
						msg: '不能为空',
						tName: 'colony',
						tId: '1'
					},
					isGuarantee: {
						msg: '不能为空',
						tName: 'colony',
						tId: '1'
					},
				}
				Rules.stdOffsurLoanBasic = {
					loanUse: {
						msg: '不能为空',
						tName: 'loanUse',
						tId: '4'
					},
					
					useDetail: {
						msg: '不能为空',
						tName: 'loanUse',
						tId: '4'
					},
				}

			}

			if (sceneType == 5) {
				console.log('通用场景')
				if (getApp().globalData.stdOffsurBaiscInfo.appluserType == 1) { //个人
					RulesArr.remove('stdOffsurSceneTruck')
					RulesArr.remove('stdOffsurSceneYst')
					RulesArr.remove('stdOffsurEntBasic')
					RulesArr.remove('stdOffsurWholesale')
					RulesArr.remove('stdOffsurIndustryTurnover')
					RulesArr.remove('stdOffsurProcuct')
					RulesArr.remove('stdOffsurService')
					RulesArr.remove('stdOffsurTraffic')
					RulesArr.remove('stdOffsurConstruction')
					RulesArr.remove('stdOffsurCommonFinancial')
					RulesArr.remove('stdOffsurCommonFinancial2')

				} else {
					RulesArr.remove('stdOffsurSceneTruck')
					RulesArr.remove('stdOffsurSceneYst')
					RulesArr.remove('stdOffsurWholesale')
					RulesArr.remove('stdOffsurIndustryTurnover')
					RulesArr.remove('stdOffsurProcuct')
					RulesArr.remove('stdOffsurService')
					RulesArr.remove('stdOffsurTraffic')
					RulesArr.remove('stdOffsurConstruction')
					RulesArr.remove('stdOffsurCommonFinancial')
					RulesArr.remove('stdOffsurCommonFinancial2')
				}

			} else if (sceneType == 4) {
				console.log('普适')
				// 判断当前行业，根据行业筛选规则
				if (getApp().globalData.stdOffsurEntBasic.industry != 1 && getApp().globalData.stdOffsurEntBasic
					.industry != 6) {
					RulesArr.remove('stdOffsurWholesale')
					RulesArr.remove('stdOffsurIndustryTurnover')
				}
				if (getApp().globalData.stdOffsurEntBasic.industry != 2) {
					RulesArr.remove('stdOffsurProcuct')
				}
				if (getApp().globalData.stdOffsurEntBasic.industry != 3) {
					RulesArr.remove('stdOffsurService')
				}
				if (getApp().globalData.stdOffsurEntBasic.industry != 4) {
					RulesArr.remove('stdOffsurTraffic')
				}
				if (getApp().globalData.stdOffsurEntBasic.industry != 5) {
					RulesArr.remove('stdOffsurConstruction')
				}
				

				//财务报表
				if (getApp().globalData.stdOffsurBaiscInfo.statementType == null) {
					RulesArr.remove('stdOffsurCommonFinancial')
					RulesArr.remove('stdOffsurCommonFinancial2')
				} else if (getApp().globalData.stdOffsurBaiscInfo.statementType == 1) {
					RulesArr.remove('stdOffsurCommonFinancial')
				} else if (getApp().globalData.stdOffsurBaiscInfo.statementType == 2) {
					RulesArr.remove('stdOffsurCommonFinancial2')
				}
				RulesArr.remove('stdOffsurSceneYst')
				RulesArr.remove('stdOffsurSceneTruck')
			} else if (sceneType == 1) {
				console.log('商用车')

				if (getApp().globalData.stdOffsurBaiscInfo.appluserType == 1) { //个人
					RulesArr.remove('stdOffsurSceneYst')
					RulesArr.remove('stdOffsurEntBasic')
					RulesArr.remove('stdOffsurWholesale')
					RulesArr.remove('stdOffsurIndustryTurnover')
					RulesArr.remove('stdOffsurProcuct')
					RulesArr.remove('stdOffsurService')
					RulesArr.remove('stdOffsurTraffic')
					RulesArr.remove('stdOffsurConstruction')
					RulesArr.remove('stdOffsurCommonFinancial')
					RulesArr.remove('stdOffsurCommonFinancial2')

				} else {
					RulesArr.remove('stdOffsurSceneYst')
					// RulesArr.remove('stdOffsurEntBasic')
					RulesArr.remove('stdOffsurWholesale')
					RulesArr.remove('stdOffsurIndustryTurnover')
					RulesArr.remove('stdOffsurProcuct')
					RulesArr.remove('stdOffsurService')
					RulesArr.remove('stdOffsurTraffic')
					RulesArr.remove('stdOffsurConstruction')
					RulesArr.remove('stdOffsurCommonFinancial')
					RulesArr.remove('stdOffsurCommonFinancial2')
				}

			} else if (sceneType == 2) {
				console.log('海吉星')
				RulesArr.remove('stdOffsurSceneTruck')
				RulesArr.remove('stdOffsurSceneYst')
				RulesArr.remove('stdOffsurWholesale')
				RulesArr.remove('stdOffsurIndustryTurnover')
				RulesArr.remove('stdOffsurProcuct')
				RulesArr.remove('stdOffsurService')
				RulesArr.remove('stdOffsurTraffic')
				RulesArr.remove('stdOffsurConstruction')
				RulesArr.remove('stdOffsurCommonFinancial')
				RulesArr.remove('stdOffsurCommonFinancial2')
			} else if (sceneType == 3) {
				console.log('雅斯特')
				RulesArr.remove('stdOffsurSceneTruck')
				RulesArr.remove('stdOffsurWholesale')
				RulesArr.remove('stdOffsurIndustryTurnover')
				RulesArr.remove('stdOffsurProcuct')
				RulesArr.remove('stdOffsurService')
				RulesArr.remove('stdOffsurTraffic')
				RulesArr.remove('stdOffsurConstruction')
				RulesArr.remove('stdOffsurCommonFinancial')
				RulesArr.remove('stdOffsurCommonFinancial2')
			}
			
			// 快贷处理
			if(getApp().globalData.stdOffsurBaiscInfo.loanType==='4'){
				RulesArr.remove('stdOffsurCommonFinancial')
				RulesArr.remove('stdOffsurCommonFinancial2')
				RulesArr.remove('stdOffsurWholesale')
				RulesArr.remove('stdOffsurIndustryTurnover')
				RulesArr.remove('stdOffsurColonyInfo')
				RulesArr.remove('stdOffsurLoanBasic')
				RulesArr.remove('stdOffsurProcuct')
				RulesArr.remove('stdOffsurService')
				RulesArr.remove('stdOffsurTraffic')
				RulesArr.remove('stdOffsurConstruction')
			}else{
				RulesArr.remove('stdOffsurJyFinance')
			}



			try {
				for (let m = 0; m < this.tabNav.length; m++) {
					this.tabNav[m].errorNun = 0
				}
				if (sceneType == 4) {
					if (getApp().globalData.stdOffsurBaiscInfo.loanType == '1') {
						if (getApp().globalData.stdOffsurBaiscInfo.statementType == null) {
							this.tabTip(8)
							flag++
						} else {
							this.cleanTabTip(8)
						}
					} else if (getApp().globalData.stdOffsurBaiscInfo.loanType == '2') {
						if (getApp().globalData.stdOffsurBaiscInfo.statementType == null) {
							this.tabTip(8)
							flag++
						} else {
							this.cleanTabTip(8)
						}
					}

				}
			} catch (err) {

			} finally {

				try {
					
					for (let i = 0; i < RulesArr.length; i++) {

						if (RulesArr[i] == 'stdOffsurCommonFinancial') { //财务报表特殊处理

							//简易报表
							let aRulesArr = Object.keys(getApp().globalData.rules[RulesArr[i]]) //获取A03  A04层
							for (let z = 0; z < aRulesArr.length; z++) {
								let bRulesArr = Object.keys(getApp().globalData.rules[RulesArr[i]][aRulesArr[
									z]]) //获取A030101数组
								for (let y = 0; y < bRulesArr.length; y++) {
									if (FormData[RulesArr[i]][aRulesArr[z]][bRulesArr[y]].endSum === '' || FormData[
											RulesArr[i]][aRulesArr[z]][
											bRulesArr[y]
										].endSum === undefined) {
										let tName = Rules[RulesArr[i]][aRulesArr[z]][bRulesArr[y]].tName
										let tId = Rules[RulesArr[i]][aRulesArr[z]][bRulesArr[y]].tId
										let refs = that.$refs.activeForm.$refs[tName].$refs

										refs[bRulesArr[y]].requiredFn(true)
										
										this.tabTip(tId)
										flag++
									} else {
										let tName = Rules[RulesArr[i]][aRulesArr[z]][bRulesArr[y]].tName
										let refs = that.$refs.activeForm.$refs[tName].$refs
										refs[bRulesArr[y]].requiredFn(false)

									}
								}

							}

						} else if (RulesArr[i] == 'stdOffsurCommonFinancial2') { //财务报表特殊处理
							
							//详细报表
							let key = 'stdOffsurCommonFinancial'
							let aRulesArr = Object.keys(getApp().globalData.rules[RulesArr[i]]) //获取A01  A02层
							for (let z = 0; z < aRulesArr.length; z++) {
								let bRulesArr = Object.keys(getApp().globalData.rules[RulesArr[i]][aRulesArr[
									z]]) //获取A010101数组
								for (let y = 0; y < bRulesArr.length; y++) {
									if (FormData[key][aRulesArr[z]][bRulesArr[y]].beginSum === '' || FormData[key][
											aRulesArr[z]
										][
											bRulesArr[y]
										].beginSum === undefined) {
										let tName = Rules[RulesArr[i]][aRulesArr[z]][bRulesArr[y]].tName
										let tId = Rules[RulesArr[i]][aRulesArr[z]][bRulesArr[y]].tId
										let refs = that.$refs.activeForm.$refs[tName].$refs

										refs[bRulesArr[y]].requiredFn(true)
										this.tabTip(tId)
										flag++
									} else if (FormData[key][aRulesArr[z]][bRulesArr[y]].endSum === '' || FormData[key]
										[aRulesArr[z]][
											bRulesArr[y]
										].endSum === undefined) {
										let tName = Rules[RulesArr[i]][aRulesArr[z]][bRulesArr[y]].tName
										let tId = Rules[RulesArr[i]][aRulesArr[z]][bRulesArr[y]].tId
										let refs = that.$refs.activeForm.$refs[tName].$refs

										refs[bRulesArr[y]].requiredFn(true)
										this.tabTip(tId)
										flag++
									} else {
										let tName = Rules[RulesArr[i]][aRulesArr[z]][bRulesArr[y]].tName
										let refs = that.$refs.activeForm.$refs[tName].$refs
										refs[bRulesArr[y]].requiredFn(false)

									}
								}

							}

						} else {
							//取对应类下面字段
							let zRulesArr = Object.keys(getApp().globalData.rules[RulesArr[i]])
							for (let j = 0; j < zRulesArr.length; j++) {

								if (FormData[RulesArr[i]][zRulesArr[j]] === '' || FormData[RulesArr[i]][zRulesArr[
										j]] === undefined ||
									FormData[RulesArr[i]][zRulesArr[j]] === null) { //非空校验

									let a = FormData[RulesArr[i]][zRulesArr[j]]
									let tName = Rules[RulesArr[i]][zRulesArr[j]].tName
									let tId = Rules[RulesArr[i]][zRulesArr[j]].tId
									let refs = that.$refs.activeForm.$refs[tName].$refs

									refs[zRulesArr[j]].requiredFn(true)
									this.tabTip(tId)
									console.log(zRulesArr[j],'必填校验未通过')
									flag++
								

								} else {

									let tName = Rules[RulesArr[i]][zRulesArr[j]].tName
									let refs = that.$refs.activeForm.$refs[tName].$refs
									refs[zRulesArr[j]].requiredFn(false)

								}

							}
							
							
						}
					}
					
					if (getApp().globalData.stdOffsurBaiscInfo.loanType !== '4'){
				
						//判断是否将申请主体作为担保主体
						//如果业务类型为个人，且申请人类型不是自然人，
						if (getApp().globalData.stdOffsurBaiscInfo.businessType == 1 && getApp().globalData
							.stdOffsurBaiscInfo.appluserType != '1') {
							if (getApp().globalData.stdOffsurBaiscInfo.guaranteeType === null) {
								this.tabTip(10)
								let refs = that.$refs.activeForm.$refs['relatedPersonInfor'].$refs
								refs['GuaranteeType'].requiredFn(true)
								flag++
							} else {
								let refs = that.$refs.activeForm.$refs['relatedPersonInfor'].$refs
								refs['GuaranteeType'].requiredFn(false)
							}
						}
						
						if (getApp().globalData.stdOffsurBaiscInfo.businessType == 2) {
							if (getApp().globalData.stdOffsurBaiscInfo.guaranteeType === null) {
								this.tabTip(10)
								let refs = that.$refs.activeForm.$refs['relatedPersonInfor'].$refs
								refs['GuaranteeType'].requiredFn(true)
								flag++
							} else {
								let refs = that.$refs.activeForm.$refs['relatedPersonInfor'].$refs
								refs['GuaranteeType'].requiredFn(false)
							}
						}
						// 判断是否有最高额合同
						if (getApp().globalData.stdOffsurBaiscInfo.maxGuaContract === null) {
							this.tabTip(10)
							let refs = that.$refs.activeForm.$refs['relatedPersonInfor'].$refs
							refs['maxGuaContract'].requiredFn(true)
							flag++
						} else {
							if (getApp().globalData.stdOffsurBaiscInfo.maxGuaContract === 'Y') {
								
						
								//判断有没有引入合同
								if (getApp().globalData.stdOffsurGnrContract.length == 0) {
									uni.showToast({
										title: '请引入最高额保证合同！',
										icon: "none",
										duration: 2500
									})
									this.tabTip(10)
									flag++
								}
						
						
							} else {
								let refs = that.$refs.activeForm.$refs['relatedPersonInfor'].$refs
								refs['maxGuaContract'].requiredFn(false)
							}
						
						}
						
						//判断押品是否有最高额抵押期限内押品,商用车除外
						if (getApp().globalData.stdOffsurBaiscInfo.sceneType != 1) {
						
							if (getApp().globalData.stdOffsurBaiscInfo.maximumMortgage === null) {
								this.tabTip(11)
								let refs = that.$refs.activeForm.$refs['coll'].$refs
								refs['maximumMortgage'].requiredFn(true)
								flag++
							} else {
								if (getApp().globalData.stdOffsurBaiscInfo.maximumMortgage === 'Y') {
									//判断说明
									if (getApp().globalData.stdOffsurBaiscInfo.maximumMortgageDesc === null || getApp()
										.globalData.stdOffsurBaiscInfo.maximumMortgageDesc === '') {
										this.tabTip(11)
										let refs = that.$refs.activeForm.$refs['coll'].$refs
										refs['maximumMortgageDesc'].requiredFn(true)
										flag++
									} else {
										let refs = that.$refs.activeForm.$refs['coll'].$refs
										refs['maximumMortgageDesc'].requiredFn(false)
									}
						
									//判断有没有引入合同
									if (getApp().globalData.stdOffsurCollateralContract.length == 0) {
										uni.showToast({
											title: '请引入最高额抵押期限内押品！！',
											icon: "none",
											duration: 2500
										})
										this.tabTip(11)
										flag++
									}
						
						
								} else {
									let refs = that.$refs.activeForm.$refs['coll'].$refs
									refs['maximumMortgage'].requiredFn(false)
								}
						
							}
						}
						
						
					}

					

					//判断续贷 必选一个借据
					if (getApp().globalData.stdOffsurBaiscInfo.loanType == '2'||getApp().globalData.stdOffsurBaiscInfo.loanType == '3') {
						let IOUArr = getApp().globalData.stdOffsurPromissoryNote
						//console.log(getApp().globalData.StdOffsurPromissory)
						let ckArr = []
						for (let i = 0; i < IOUArr.length; i++) {
							if (IOUArr[i].checkState) {
								ckArr.push(IOUArr[i])
							}
						}

						//判断有没有选择借据
						if (ckArr.length == 0) {
							this.tabTip(14)
							uni.showToast({
								title: '请先选择借据信息',
								icon: "none",
								duration: 2000
							})
							flag++
							return false
						} else {
							for (let j = 0; j < ckArr.length; j++) {
								if(Number(ckArr[j].formerAmount)<=0){
									uni.showToast({
										title: '还旧金额需要大于0',
										icon: "none",
										duration: 2000
									})
									flag++
									return false
								}
							}
							this.StdOffsurPromissory = ckArr
						}
						//判断loanType=3 sum（还旧金额）=申请金额
						if (getApp().globalData.stdOffsurBaiscInfo.loanType == '3') {

							// let ckSum = 0
							// for (let j = 0; j < ckArr.length; j++) {
							// 	ckSum += Number(ckArr[j].formerAmount)
							// }
							// console.log(ckSum)
							// if (ckSum != getApp().globalData.stdOffsurBaiscInfo.applyAmount) {
							// 	this.tabTip(14)
							// 	uni.showToast({
							// 		title: '还旧金额之和必须等于申请金额。',
							// 		icon: "none",
							// 		duration: 2000
							// 	})
							// 	flag++
							// } else {
							// 	console.log('3', ckArr)
							// 	this.StdOffsurPromissory = ckArr

							// 	console.log('4', this.StdOffsurPromissory)
							// }

							//风险化解陈述为必填
							if (!getApp().globalData.stdOffsurBaiscInfo.riskDefuse) {
								this.tabTip(15)
								uni.showToast({
									title: '风险化解陈述及影像为必填',
									icon: "none",
									duration: 2000
								})
								flag++
							}
							console.log(getApp().globalData.imageData.replyData.SDMS_0601_39)
							if (getApp().globalData.imageData.replyData.SDMS_0601_39.length == 1) {
								this.tabTip(15)
								uni.showToast({
									title: '风险化解陈述影像为必填',
									icon: "none",
									duration: 2000
								})
								flag++
							}
						}

					}
					
					

				} catch (err) {
					console.log('catchErr',err)
					flag++
				} finally {

					for (let i = 0; i < this.tabNav.length; i++) {
						if (this.tabNav[i].errorNun > 0) {
						
							this.tabNav[i].error = true
						} else {
							this.tabNav[i].error = false
						}
					}
					
					console.log(flag,'错误数')
					if (!flag) {
						
						return true
					} else {
						return false
					}
				}

			}

		},
		//提交接口
		submit() {
			if (this.verification()) {
				//getApp().globalData.stdOffsurBaiscInfo.appluserType==2  股东必须有一条法人担保
				//根据场景判断必填规则
				// 1>商用车：经营主体，行业，财务为非必填
				// 2>雅斯特，海吉星 经营主体为必填，行业情况，财务为非必填
				// 3>不选，经营主体，行业，财务为必填

				let flag = 0
				//经营主体非商用车 费用判断
				let fy = getApp().globalData.stdOffsurLoanCost
				let sceneType = getApp().globalData.stdOffsurBaiscInfo.sceneType //场景选择
				let industry = getApp().globalData.stdOffsurEntBasic.industry //行业
				if (sceneType == 1 && getApp().globalData.stdOffsurBaiscInfo.loanType != '3') { //商用车
					if (getApp().globalData.stdOffsurSceneTruckDetail.length == 0) {
						uni.showToast({
							title: '请至少补充完整一条【所要购置的商用车信息】',
							icon: "none",
							duration: 2000
						})
						return false
					} else {
						let arr = ['truckType', 'truckModel', "mortgageSystemId"] //affiliationComp
						let car = getApp().globalData.stdOffsurSceneTruckDetail
						for (let i = 0; i < car.length; i++) {
							for (let y = 0; y < arr.length; y++) {
								if (car[i][arr[y]] == '') {
									uni.showToast({
										title: '请补充完整一条【所要购置的商用车信息】',
										icon: "none",
										duration: 2000
									})
									return false
								}
							}
						}
					}
				}
				if (sceneType == 2) { //海吉星

					let arr = getApp().globalData.stdOffsurSceneHjx
					let rule = ['inGoods', 'outGoods', 'inAmount', 'marDebtAmount', 'inMarketYears']
					for (let i = 0; i < arr.length; i++) {
						for (let y = 0; y < rule.length; y++) {
							if (arr[i][rule[y]] === '') {
								uni.showToast({
									title: '请补充完场景【海吉星】基本信息',
									icon: "none",
									duration: 2000
								})
								return false
							}
						}
					}
				}
				if (sceneType == 4 && getApp().globalData.stdOffsurBaiscInfo.loanType != '3' && getApp().globalData.stdOffsurBaiscInfo.loanType != '4') {
					//进行销售额月份信息确认
					let busyMonths = 0
					let middleMonths = 0
					let lowMonths = 0
					if (getApp().globalData.stdOffsurIndustryTurnover.busyMonths === null || getApp().globalData
						.stdOffsurIndustryTurnover.busyMonths === undefined || getApp().globalData
						.stdOffsurIndustryTurnover.busyMonths === '') {
						getApp().globalData.stdOffsurIndustryTurnover.busyMonths = ''
						busyMonths = 0
					} else {
						busyMonths = getApp().globalData.stdOffsurIndustryTurnover.busyMonths.split(',').length
					}
					if (getApp().globalData.stdOffsurIndustryTurnover.middleMonths === null || getApp().globalData
						.stdOffsurIndustryTurnover.middleMonths === undefined || getApp().globalData
						.stdOffsurIndustryTurnover.middleMonths === '') {
						getApp().globalData.stdOffsurIndustryTurnover.middleMonths = ''
						middleMonths = 0
					} else {
						middleMonths = getApp().globalData.stdOffsurIndustryTurnover.middleMonths.split(',').length
					}
					if (getApp().globalData.stdOffsurIndustryTurnover.lowMonths === null || getApp().globalData
						.stdOffsurIndustryTurnover.lowMonths === undefined || getApp().globalData
						.stdOffsurIndustryTurnover.lowMonths === '') {
						getApp().globalData.stdOffsurIndustryTurnover.lowMonths = ''
						lowMonths = 0
					} else {
						lowMonths = getApp().globalData.stdOffsurIndustryTurnover.lowMonths.split(',').length
					}



					let monLength = busyMonths + middleMonths + lowMonths
					//console.log(monLength)
					if (industry == 1 || industry == 6) {
						let plzb = 0
						for (let s = 0; s < getApp().globalData.stdOffsurWholesaleGoods.length; s++) {
							plzb += Number(getApp().globalData.stdOffsurWholesaleGoods[s].turnoverRatio)
						}

						if (plzb > 100) {
							uni.showToast({
								title: '经营品类年营业额占比超过100%,请重新确认',
								icon: "none",
								duration: 2000
							})
							return false
						}

						if (getApp().globalData.shangyou01.length < 1 || getApp().globalData.xiayou01.length < 1) {
							uni.showToast({
								title: '请填写行业上下游信息',
								icon: "none",
								duration: 2000
							})

							return false
						} else {
							let moneyRatio = 0
							for (let s = 0; s < getApp().globalData.shangyou01.length; s++) {
								moneyRatio += Number(getApp().globalData.shangyou01[s].moneyRatio)
							}

							if (moneyRatio > 100) {
								uni.showToast({
									title: '行业上游占比超过100%，无法提交',
									icon: "none",
									duration: 2000
								})
								return false
							}

							let xmoneyRatio = 0
							for (let xy = 0; xy < getApp().globalData.xiayou01.length; xy++) {
								xmoneyRatio += Number(getApp().globalData.xiayou01[xy].moneyRatio)
							}

							if (xmoneyRatio > 100) {
								uni.showToast({
									title: '行业下游占比超过100%，无法提交',
									icon: "none",
									duration: 2000
								})
								return false
							}
						}


					}
					if (industry == 2) {

						if (getApp().globalData.shangyou02.length < 1 || getApp().globalData.xiayou02.length < 1) {
							uni.showToast({
								title: '请填写行业上下游信息',
								icon: "none",
								duration: 2000
							})

							return false
						} else {
							let moneyRatio = 0
							for (let s = 0; s < getApp().globalData.shangyou02.length; s++) {
								moneyRatio += Number(getApp().globalData.shangyou02[s].moneyRatio)
							}

							if (moneyRatio > 100) {
								uni.showToast({
									title: '行业上游占比超过100%，无法提交',
									icon: "none",
									duration: 2000
								})
								return false
							}

							let xmoneyRatio = 0
							for (let xy = 0; xy < getApp().globalData.xiayou02.length; xy++) {
								xmoneyRatio += Number(getApp().globalData.xiayou02[xy].moneyRatio)
							}

							if (xmoneyRatio > 100) {
								uni.showToast({
									title: '行业下游占比超过100%，无法提交',
									icon: "none",
									duration: 2000
								})
								return false
							}
						}
					}
					if (industry == 5) {

						if (getApp().globalData.stdOffsurConstructionProject.length < 1) {
							uni.showToast({
								title: '请填写建筑类前三大项目',
								icon: "none",
								duration: 2000
							})

							return false
						}
						if (getApp().globalData.stdOffsurConstructionMainCust.length < 1) {
							uni.showToast({
								title: '请填写建筑类前主要上游信息',
								icon: "none",
								duration: 2000
							})

							return false
						}
					}
					if (industry == 1 || industry == 2 || industry == 3 || industry == 6) {
						if (monLength != 12) {
							uni.showToast({
								title: '请确认经营行业【销售额信息】月份，未满足12个月',
								icon: "none",
								duration: 2000
							})

							return false
						}
					}

					//费用判断
					for (let z = 0; z < fy.length; z++) {
						if (fy[z].cost12months === null || fy[z].cost12months === '') {
							uni.showToast({
								title: '请补充完善【经营行业】-费用',
								icon: "none",
								duration: 2000
							})
							flag++
							break
						}
					}

				}
				//个人  家用车车牌校验
				for(let c=0;c<getApp().globalData.stdOffsurCars.length;c++){
					if(!getApp().globalData.stdOffsurCars[c].carCode){
						uni.showToast({
							title: '个人基本信息-汽车车牌号码请补全',
							icon: "none",
							duration: 2000
						})
						flag++
						break
					}
					
				}
				
				
				//最高额抵押期限内押品：拟申请占用金额（元）：
				for (let i = 0; i < getApp().globalData.stdOffsurCollateralContract.length; i++) {
					if (getApp().globalData.stdOffsurCollateralContract[i].applOccupyAmt === '0') {
						uni.showToast({
							title: '最高额抵押期限内押品：拟申请占用金额不能为0',
							icon: "none",
							duration: 2500
						})
						flag++
						break
					}
					if (getApp().globalData.stdOffsurCollateralContract[i].applOccupyAmt === '') {
						uni.showToast({
							title: '最高额抵押期限内押品：拟申请占用金额为必填',
							icon: "none",
							duration: 2500
						})
						flag++
						break
					}
				}
				
					if (getApp().globalData.stdOffsurBaiscInfo.maxGuaContract === 'Y') {
						//最高额保证合同：拟申请占用金额（元）：
						for (let i = 0; i < getApp().globalData.stdOffsurGnrContract.length; i++) {
							if (getApp().globalData.stdOffsurGnrContract[i].applOccupyAmt === '0') {
								uni.showToast({
									title: '最高额保证合同：拟申请占用金额不能为0',
									icon: "none",
									duration: 2500
								})
								flag++
								break
							}
							if (getApp().globalData.stdOffsurGnrContract[i].applOccupyAmt === '') {
								uni.showToast({
									title: '最高额保证合同：拟申请占用金额为必填',
									icon: "none",
									duration: 2500
								})
								flag++
								break
							}
							if (Number(getApp().globalData.stdOffsurGnrContract[i].applOccupyAmt) > Number(getApp().globalData
								.stdOffsurGnrContract[i].maxGurtAmt)) {
								uni.showToast({
									title: '最高额保证合同：拟申请占用金额不能大于最高额担保金额',
									icon: "none",
									duration: 2500
								})
								flag++
								break
							}
						}
					}				
				
				
				//进行押品唯一校验,进行抵押人必填校验
				for (let i = 0; i < getApp().globalData.stdOffsurCollateral03.length; i++) {
					//mortgageAdd资产所在地
					if (!getApp().globalData.stdOffsurCollateral03[i].mortgageAdd) {
						uni.showToast({
							title: '押品：' + getApp().globalData.stdOffsurCollateral03[i].buildingName +
								',资产所在地为必填',
							icon: "none",
							duration: 2000
						})
						flag++
						break
					}

					//certificateCode
					if (!getApp().globalData.stdOffsurCollateral03[i].certificateCode) {
						uni.showToast({
							title: '押品：' + getApp().globalData.stdOffsurCollateral03[i].buildingName +
								',产品证号为必填',
							icon: "none",
							duration: 2000
						})
						flag++
						break
					}
					if (!getApp().globalData.stdOffsurCollateral03[i].mortgageSystemId) {
						uni.showToast({
							title: '押品：' + getApp().globalData.stdOffsurCollateral03[i].buildingName +
								',未通过唯一校验',
							icon: "none",
							duration: 2000
						})
						flag++
						break
					}
					//评估价值、线上或人工
					if (!getApp().globalData.stdOffsurCollateral03[i].autoAssessPrice) {
						if (!getApp().globalData.stdOffsurCollateral03[i].manAssessPrice) {
							uni.showToast({
								title: '押品：' + getApp().globalData.stdOffsurCollateral03[i].buildingName +
									',评估价值必填',
								icon: "none",
								duration: 2000
							})
							flag++
							break

						}

					}
					if(getApp().globalData.stdOffsurBaiscInfo.loanType==='4'){
						if (!getApp().globalData.stdOffsurCollateral03[i].autoAssessPrice) {
							uni.showToast({
								title: '押品：' + getApp().globalData.stdOffsurCollateral03[i].buildingName +
										',线上评估价值未测算',
								icon: "none",
								duration: 2000
							})
							flag++
							break
						}
						if (!getApp().globalData.stdOffsurCollateral03[i].manAssessPrice) {
							uni.showToast({
								title: '押品：' + getApp().globalData.stdOffsurCollateral03[i].buildingName +
									',人工评估价值必填',
								icon: "none",
								duration: 2000
							})
							flag++
							break
						
						}
						if (!getApp().globalData.stdOffsurCollateral03[i].mortgageCalculAmount) {
							uni.showToast({
								title: '存在未完成额度测算的押品，请完成测算后再提交',
								icon: "none",
								duration: 2000
							})
							flag++
							break
						
						}
						
					}
					if (!getApp().globalData.stdOffsurCollateral03[i].firstMortgage) {
						uni.showToast({
							title: '房产' + (i+1) + ',是否第一顺位抵押为必填',
							icon: "none",
							duration: 2000
						})
						flag++
						break
					}
					if (getApp().globalData.stdOffsurCollateral03[i].firstMortgage==='02') {
						
						
						if (!getApp().globalData.stdOffsurCollateral03[i].mortagageCount) {
							uni.showToast({
								title: '房产' + (i+1) + ',抵押次数为必填',
								icon: "none",
								duration: 2000
							})
							flag++
							break
						}
					}

					// 抵押人信息必填校验
					let obligee = getApp().globalData.stdOffsurCollateral03[i].obligeeNameList
					if (obligee.length == 0) {
						uni.showToast({
							title: '押品信息至少有一个抵押人,请补全录入',
							icon: "none",
							duration: 2000
						})
						flag++
						break
					}

					for (let z = 0; z < obligee.length; z++) {

						let obligeeNameList = []
						//2022-1-14需求 抵押人信息【住所】residence、【详细地址】tranAdd、【联系电话】telephone字段及押品信息【贷款余额】字段取消必输校验； 
						if (obligee[z].pledgorType == 1) {
							obligeeNameList = ['pledgorType', 'idenCode', 'pledgorName', 'maritalStatusCode']
						} else if (obligee[z].pledgorType == 2) {
							obligeeNameList = ['pledgorType', 'idenCode', 'pledgorName', 'frName','frIdentificationNumber',]
						} else {
							//console.log(obligee.pledgorType)
							uni.showToast({
								title: '请补全押品，抵押人基本信息！',
								icon: "none",
								duration: 2000
							})
							flag++
						}
						if(obligee[z].pledgorType == 1){
							if(obligee[z].maritalStatusCode==='20'&&obligee[z].maritalBelongPledgor==='02'){
								if(!obligee[z].maritalName||!obligee[z].maritalIdCode||!obligee[z].maritalTelephone){
									uni.showToast({
										title: '请补全抵押人配偶信息',
										icon: "none",
										duration: 2000
									})
									flag++
									break
								}
							}
							
						}
						

						for (let y = 0; y < obligeeNameList.length; y++) {
							if (!obligee[z][obligeeNameList[y]]) {
								//console.log(obligee[z][obligeeNameList[y]],obligeeNameList[y])
								uni.showToast({
									title: '请补全押品，抵押人基本信息！',
									icon: "none",
									duration: 2000
								})
								flag++
								break
							}
							
						}
						
						// 与共借人比对 姓名
						 let co = getApp().globalData.stdOffsurCoBorrowerBasic
						 for(let o=0;o<co.length;o++){
							 if(obligee[z].idenCode === co[o].certificatesNumber ){
								 if(obligee[z].pledgorName!==co[o].borrowerName ){
									 uni.showToast({
									 	title: '存在共借人'+co[o].borrowerName+'与抵押人证件号码一致，名称不一致，请重新核对',
									 	icon: "none",
									 	duration: 2000
									 })
									 flag++
									 break
								 }
							 }
						 }
					}
				}

				//进行其他押品唯一校验,进行抵押人必填校验
				for (let i = 0; i < getApp().globalData.stdOffsurCollateral04.length; i++) {
					if( getApp().globalData.stdOffsurBaiscInfo.loanType==='4'){
					
						if (!getApp().globalData.stdOffsurCollateral04[i].mortgageCalculAmount) {
							uni.showToast({
								title: '存在未完成额度测算的押品，请完成测算后再提交',
								icon: "none",
								duration: 2000
							})
							flag++
							break
						
						}

					}
					

					if (!getApp().globalData.stdOffsurCollateral04[i].pledgeType) {
						uni.showToast({
							title: '其他押品' + i + ',押品名称为必填',
							icon: "none",
							duration: 2000
						})
						flag++
						break
					}
					//manAssessPrice
					if (!getApp().globalData.stdOffsurCollateral04[i].manAssessPrice) {
						uni.showToast({
							title: '其他押品' + i + ',评估价值为必填',
							icon: "none",
							duration: 2000
						})
						flag++
						break
					}
					let  loanType = getApp().globalData.stdOffsurBaiscInfo.loanType
					if (loanType!=='4'&&!getApp().globalData.stdOffsurCollateral04[i].unit) {
						uni.showToast({
							title: '其他押品' + i + ',单位为必填',
							icon: "none",
							duration: 2000
						})
						flag++
						break
					}
					if (!getApp().globalData.stdOffsurCollateral04[i].pledgeDetail) {
						uni.showToast({
							title: '其他押品' + i + ',押品状况描述为必填',
							icon: "none",
							duration: 2000
						})
						flag++
						break
					}
					if (!getApp().globalData.stdOffsurCollateral04[i].firstMortgage) {
						uni.showToast({
							title: '其他押品' + i + ',是否第一顺位抵押为必填',
							icon: "none",
							duration: 2000
						})
						flag++
						break
					}
					if (getApp().globalData.stdOffsurCollateral04[i].firstMortgage==='02') {
						
						if (!getApp().globalData.stdOffsurCollateral04[i].mortagageCount) {
							uni.showToast({
								title: '其他押品' + i + ',抵押次数为必填',
								icon: "none",
								duration: 2000
							})
							flag++
							break
						}
					}
					
					if (!getApp().globalData.stdOffsurCollateral04[i].mortgageSystemId) {
						uni.showToast({
							title: '其他押品：' + getApp().globalData.stdOffsurCollateral04[i].pledgeType +
								',未通过唯一校验',
							icon: "none",
							duration: 2000
						})
						flag++
						break
					}
					if (getApp().globalData.stdOffsurCollateral04[i].ypType == '01') {
						if (!getApp().globalData.stdOffsurCollateral04[i].area) {
							uni.showToast({
								title: '其他押品：' + getApp().globalData.stdOffsurCollateral04[i].pledgeType +
									',抵押【数量/面积】为必填',
								icon: "none",
								duration: 2000
							})
							flag++
							break
						}

					}
					// 抵押人信息必填校验
					let obligee = getApp().globalData.stdOffsurCollateral04[i].obligeeNameList
					if (obligee.length == 0) {
						uni.showToast({
							title: '押品信息至少有一个抵押人,请补全录入',
							icon: "none",
							duration: 2000
						})
						flag++
						break
					}

					for (let z = 0; z < obligee.length; z++) {

						let obligeeNameList = []
						if (obligee[z].pledgorType == 1) {
							obligeeNameList = ['pledgorType', 'idenCode', 'pledgorName','maritalStatusCode' ]
						} else if (obligee[z].pledgorType == 2) {
							obligeeNameList = ['pledgorType', 'idenCode', 'pledgorName', 'frName','frIdentificationNumber',]
						} else {
							//console.log(obligee.pledgorType)
							uni.showToast({
								title: '请补全押品，抵押人基本信息！',
								icon: "none",
								duration: 2000
							})
							flag++
						}
						if(obligee[z].pledgorType == 1){
							if(obligee[z].maritalStatusCode==='20'&&obligee[z].maritalBelongPledgor==='02'){
								if(!obligee[z].maritalName||!obligee[z].maritalIdCode||!obligee[z].maritalTelephone){
									uni.showToast({
										title: '请补全抵押人配偶信息',
										icon: "none",
										duration: 2000
									})
									flag++
									break
								}
							}
							
						}
						

						for (let y = 0; y < obligeeNameList.length; y++) {
							if (!obligee[z][obligeeNameList[y]]) {
								//console.log(obligee[z][obligeeNameList[y]],obligeeNameList[y])
								uni.showToast({
									title: '请补全押品，抵押人基本信息！',
									icon: "none",
									duration: 2000
								})
								flag++
								break
							}
						}
						
						
						// 与共借人比对 姓名
						 let co = getApp().globalData.stdOffsurCoBorrowerBasic
						 for(let o=0;o<co.length;o++){
							 if(obligee[z].idenCode === co[o].certificatesNumber ){
								 if(obligee[z].pledgorName!==co[o].borrowerName ){
									 uni.showToast({
									 	title: '存在共借人'+co[o].borrowerName+'与抵押人证件号码一致，名称不一致，请重新核对',
									 	icon: "none",
									 	duration: 2000
									 })
									 flag++
									 break
								 }
							 }
						 }
					}

				}
				//getApp().globalData.stdOffsurBaiscInfo.appluserType==2  股东必须有一条法人担保或者共借人担保
				if (getApp().globalData.stdOffsurBaiscInfo.appluserType == 2 &&getApp().globalData.stdOffsurBaiscInfo.loanType!=='4') {
					let b = 0
					for (let a = 0; a < getApp().globalData.stdOffsurSceneLoanRelation.length; a++) {
						if (getApp().globalData.stdOffsurSceneLoanRelation[a].ideyAttribute === '01') {
							b++
						}
					}
					let c = 0
					for (let a = 0; a < getApp().globalData.stdOffsurCoBorrowerBasic.length; a++) {
						if (getApp().globalData.stdOffsurCoBorrowerBasic[a].identityAttribute === '01') {
							c++
						}
					}
					let d = b+c

					if (d === 0) {
						uni.showToast({
							title: '股东申请时，担保主体/共借人信息必须有一条【法定代表人】信息',
							icon: "none",
							duration: 2500
						})
						flag++
						return false
					}
				}
				//2022-6 共借人必填校验
				if (getApp().globalData.stdOffsurBaiscInfo.loanType == '1') {
					//判断是都为自然人：只能填写商用车，企业相关信息禁用
					if (getApp().globalData.stdOffsurBaiscInfo.businessType === '1') {
						for(let co=0;co<getApp().globalData.stdOffsurCoBorrowerBasic.length;co++){
							let item = getApp().globalData.stdOffsurCoBorrowerBasic[co]
							if(!item.borrowerName ||!item.certificatesType ||!item.certificatesNumber ||!item.borrowerMoblie ||!item.homeAddress ||!item.homeAddrsDetail ||!item.maritalStatus ||!item.identityAttribute ||item.otherIncome==='' ){
								uni.showToast({
									title: '请补全共同借款人：' + item.borrowerName + '客户信息',
									icon: "none",
									duration: 2000
								})
								flag++
								break
							}
							
							// 202206反洗钱需求校验
							if(!item.endDate||!item.startDate){
								uni.showToast({
									title: '共借人客户证件有效期不能为空',
									icon: "none",
									duration: 2000
								})
								flag++
								break
								
							}
							let nowDate= new Date().getTime()
							let endDate = new Date(item.endDate).getTime()
							let startDate = new Date(item.startDate).getTime()
							if(item.endDate!="长期"){
									
									if(nowDate>endDate){
										uni.showToast({
											title: '共借人客户证件已过期，请核实并更新证件后提交！',
											icon: "none",
											duration: 2000
										})
										flag++
										break
									}
									if(nowDate<startDate){
										uni.showToast({
											title: '共借人客户证件其实时间大于当前时间，请核实并更新证件后提交！',
											icon: "none",
											duration: 2000
										})
										flag++
										break
									}
							}else{
								if(nowDate<startDate){
									uni.showToast({
										title: '共借人客户证件其实时间大于当前时间，请核实并更新证件后提交！',
										icon: "none",
										duration: 2000
									})
									flag++
									break
								}
							}
							
							// 共借人车产校验
							for(let c=0;c<item.stdOffsurCars.length;c++){
								if(!item.stdOffsurCars[c].carCode){
									uni.showToast({
										title: '共借人汽车车牌号码请补全',
										icon: "none",
										duration: 2000
									})
									flag++
									break
								}
								
							}
							
							
							
						}
						
						
						
					}	
				}		
				//2022-4需求  其他主体 必填校验
				for (let y1 = 0; y1 < getApp().globalData.stdOffsurEntRelation.length; y1++) {
					let item = getApp().globalData.stdOffsurEntRelation[y1]

					if (item.subjectType === '1') {
						if (!item.relType || !item.entName || !item.creditCode || !item.opeAdd || !item
							.businessDetailAddress || !
							item.maritalStatus || !item.telephone || !item.employer || !item.position || !item
							.employerAddress ||
							item.incomeYear==='' || item.endTotalAssets==='' || item.endTotalLiability===''
						) {
							uni.showToast({
								title: '请补全其他主体：' + item.entName + '必填项！',
								icon: "none",
								duration: 2000
							})
							flag++
							break
						}
						
						// 202206反洗钱需求校验
						if(!item.endDate||!item.startDate){
							uni.showToast({
								title: '其他主体证件有效期不能为空',
								icon: "none",
								duration: 2000
							})
							flag++
							break	
						}else{
							let nowDate= new Date().getTime()
							let endDate = new Date(item.endDate).getTime()
							let startDate = new Date(item.startDate).getTime() 
							if(item.endDate!="长期"){
								if(nowDate>endDate){
									uni.showToast({
										title: '其他主体证件有效期已过期',
										icon: "none",
										duration: 2000
									})
									flag++
									break
								}
								if(nowDate<startDate){
									uni.showToast({
										title: '其他主体证件有效期有误',
										icon: "none",
										duration: 2000
									})
									flag++
									break
								}
								
							}else{
								if(nowDate<startDate){
									uni.showToast({
										title: '其他主体证件有效期有误',
										icon: "none",
										duration: 2000
									})
									flag++
									break
							    }
								
							}
						
						}
						
						
						

					} else {
						if (!item.relType || !item.entName || !item.creditCode || !item.frName || !item.legalIdCode ||
							!item.telephone || !item.mainBusi || !item.opeAdd || !item.businessDetailAddress || item.endTotalAssets==='' ||
								item.endTotalLiability==='' || item.incomeYear==='' || item.profitYear===''|| item.netProfitYear===''
						) {
							uni.showToast({
								title: '请补全其他主体：' + item.entName + '必填项！',
								icon: "none",
								duration: 2000
							})
							flag++
							break
						}
						
						// 202206反洗钱需求校验
						if(!item.endDate||!item.startDate){
							uni.showToast({
								title: '其他主体客户证件有效期不能为空',
								icon: "none",
								duration: 2000
							})
							flag++
							break
						}
						if(!item.entEndDate||!item.entStartDate){
							uni.showToast({
								title: '其他主体客户证件有效期不能为空',
								icon: "none",
								duration: 2000
							})
							flag++
							break
						}
						let nowDate= new Date().getTime()
						let endDate = new Date(item.endDate).getTime()
						let startDate = new Date(item.startDate).getTime() 
						if(item.endDate!="长期"){	
								if(nowDate>endDate){
									uni.showToast({
										title: '其他主体客户证件已过期，请核实并更新证件后提交！',
										icon: "none",
										duration: 2000
									})
									flag++
									break
								}
								if(nowDate<startDate){
									uni.showToast({
										title: '其他主体客户证件起始时间大于当前时间，请核实并更新证件后提交！',
										icon: "none",
										duration: 2000
									})
									flag++
									break
								}
						
						}else{
							if(nowDate<startDate){
								uni.showToast({
									title: '其他主体客户证件起始时间大于当前时间，请核实并更新证件后提交！',
									icon: "none",
									duration: 2000
								})
								flag++
								break
							}
							
						}
						let entEndDate = new Date(item.entEndDate).getTime()
						let entStartDate = new Date(item.entStartDate).getTime()
						if(item.entEndDate!="长期"){									
								if(nowDate>entEndDate){
									uni.showToast({
										title: '其他主体客户证件已过期，请核实并更新证件后提交！',
										icon: "none",
										duration: 2000
									})
									flag++
									break
								}
								if(nowDate<entStartDate){
									uni.showToast({
										title: '其他主体客户证件起始时间大于当前时间，请核实并更新证件后提交！',
										icon: "none",
										duration: 2000
									})
									flag++
									break
								}
						
						}else{
							if(nowDate<entStartDate){
								uni.showToast({
									title: '其他主体客户证件起始时间大于当前时间，请核实并更新证件后提交！',
									icon: "none",
									duration: 2000
								})
								flag++
								break
							}
						}
					}
				}
				//担保人电话校验getApp().globalData.stdOffsurSceneLoanRelation
				//console.log(getApp().globalData.stdOffsurSceneLoanRelation)
				for (let y = 0; y < getApp().globalData.stdOffsurSceneLoanRelation.length; y++) {
					let item= getApp().globalData.stdOffsurSceneLoanRelation[y]
				
					if (!item.relName) {
						uni.showToast({
							title: '担保：' + item.relName +
								',名称不能为空！',
							icon: "none",
							duration: 2000
						})
						flag++
						break
					}
					if (!item.telephone) {
						uni.showToast({
							title: '担保：' + item.relName +
								',手机号不能为空！',
							icon: "none",
							duration: 2000
						})
						flag++
						break
					}
					if (!item.idCode) {
						uni.showToast({
							title: '担保：' + item.relName +
								',证件号码不能为空！',
							icon: "none",
							duration: 2000
						})
						flag++
						break
					}
					if (!item.ideyAttribute) {
						uni.showToast({
							title: '担保：' + item.relName +
								',身份属性不能为空！',
							icon: "none",
							duration: 2000
						})
						flag++
						break
					}
					
					
					if (item.subjectType === '1'){
						//famAddress
						if (!item.famAddress) {
							uni.showToast({
								title: '担保：' + item.relName +
									',家庭住址不能为空！',
								icon: "none",
								duration: 2000
							})
							flag++
							break
						}
						if (!item.detailAddress) {
							uni.showToast({
								title: '担保：' + item.relName +
									',家庭详细住址不能为空！',
								icon: "none",
								duration: 2000
							})
							flag++
							break
						}
						//
						if(item.marStatus==='20'){
							if(!item.maritalName||!item.maritalTelephone||!item.maritalOrg){
								uni.showToast({
									title: '请完善担保：' + item.relName +
										',配偶基本信息',
									icon: "none",
									duration: 2000
								})
								flag++
								break
							}
						}
						// 202206反洗钱需求校验
						if(!item.endDate||!item.startDate){
							uni.showToast({
								title: '担保主体客户证件有效期不能为空',
								icon: "none",
								duration: 2000
							})
							flag++
							break
							
						}
						let nowDate= new Date().getTime()
						let endDate = new Date(item.endDate).getTime()
						let startDate = new Date(item.startDate).getTime()
						if(item.endDate!="长期"){
								
								if(nowDate>endDate){
									uni.showToast({
										title: '担保主体客户证件已过期，请核实并更新证件后提交！',
										icon: "none",
										duration: 2000
									})
									flag++
									break
								}
								if(nowDate<startDate){
									uni.showToast({
										title: '担保主体客户证件起始时间大于当前时间，请核实并更新证件后提交！',
										icon: "none",
										duration: 2000
									})
									flag++
									break
								}
						}else{
							if(nowDate<startDate){
								uni.showToast({
									title: '担保主体客户证件起始时间大于当前时间，请核实并更新证件后提交！',
									icon: "none",
									duration: 2000
								})
								flag++
								break
							}
						}
						
					}else{
						if(!item.endDate||!item.startDate){
							uni.showToast({
								title: '担保主体客户证件有效期不能为空',
								icon: "none",
								duration: 2000
							})
							flag++
							break
						}
						if(!item.entEndDate||!item.entStartDate){
							uni.showToast({
								title: '担保主体客户证件有效期不能为空',
								icon: "none",
								duration: 2000
							})
							flag++
							break
							
						}
						let nowDate= new Date().getTime()
						let endDate = new Date(item.endDate).getTime()
						let startDate = new Date(item.startDate).getTime()
						if(item.endDate!="长期"){	
				
								if(nowDate>endDate){
									uni.showToast({
										title: '担保主体客户证件已过期，请核实并更新证件后提交！',
										icon: "none",
										duration: 2000
									})
									flag++
									break
								}
								
								if(nowDate<startDate){
									uni.showToast({
										title: '担保主体客户证件起始时间大于当前时间，请核实并更新证件后提交！',
										icon: "none",
										duration: 2000
									})
									flag++
									break
								}
				
						}else{
							if(nowDate<startDate){
								uni.showToast({
									title: '担保主体客户证件起始时间大于当前时间，请核实并更新证件后提交！',
									icon: "none",
									duration: 2000
								})
								flag++
								break
							}
							
						}
						let entEndDate = new Date(item.entEndDate).getTime()
						let entStartDate = new Date(item.entStartDate).getTime()
						if(item.entEndDate!="长期"){
								if(nowDate>entEndDate){
									uni.showToast({
										title: '担保主体客户证件已过期，请核实并更新证件后提交！',
										icon: "none",
										duration: 2000
									})
									flag++
									break
								}
								if(nowDate<entStartDate){
									uni.showToast({
										title: '担保主体客户证件起始时间大于当前时间，请核实并更新证件后提交！',
										icon: "none",
										duration: 2000
									})
									flag++
									break
								}
				
						}else{
							if(nowDate<entStartDate){
								uni.showToast({
									title: '担保主体客户证件起始时间大于当前时间，请核实并更新证件后提交！',
									icon: "none",
									duration: 2000
								})
								flag++
								break
							}
						}
						
					}
					
					// 担保人汽车车牌校验
					for(let c=0;c<item.stdOffsurCars.length;c++){
						if(!item.stdOffsurCars[c].carCode){
							uni.showToast({
								title: '担保人汽车车牌号码请补全',
								icon: "none",
								duration: 2000
							})
							flag++
							break
						}
						
					}
						
				}
				
				// 判断资产明细  字段
				let stdOffsurAssetLiability = getApp().globalData.stdOffsurAssetLiability
				if(stdOffsurAssetLiability){
					if(stdOffsurAssetLiability.collaterals){
						//应收账款、其他应收款
						let arr= stdOffsurAssetLiability.collaterals.receiveAccount
						for(let i=0;i<arr.length;i++){
							if(!arr[i].occurTime){
								uni.showToast({
									title: '请补全资产明细——应收账款、其他应收款——发生日期',
									icon: "none",
									duration: 2000
								})
								flag++
								break
							}
							if(!arr[i].receiveTimePlan){
								uni.showToast({
									title: '请补全资产明细——应收账款、其他应收款——预计回收时间',
									icon: "none",
									duration: 2000
								})
								flag++
								break
							}
						}
						//预付账款
						let arr2= stdOffsurAssetLiability.collaterals.prePayAccount
						for(let i=0;i<arr2.length;i++){
							if(!arr2[i].occurTime){
								uni.showToast({
									title: '请补全资产明细——预付账款——发生日期',
									icon: "none",
									duration: 2000
								})
								flag++
								break
							}
							if(!arr2[i].prePayTimePlan){
								uni.showToast({
									title: '请补全资产明细——预付账款——预计到货时间',
									icon: "none",
									duration: 2000
								})
								flag++
								break
							}
						}
					}
					// 负债明细
					if(stdOffsurAssetLiability.debts){
						let arr= stdOffsurAssetLiability.debts.payAccount
						
						for(let i=0;i<arr.length;i++){
							if(!arr[i].occurTime){
								uni.showToast({
									title: '请补全资产明细——应付账款、其他应付款——发生日期',
									icon: "none",
									duration: 2000
								})
								flag++
								break
							}
							if(!arr[i].payTimePlan){
								uni.showToast({
									title: '请补全资产明细——应付账款、其他应付款——预计付款时间',
									icon: "none",
									duration: 2000
								})
								flag++
								break
							}
						}
						
						//预收账款
						let arr2= stdOffsurAssetLiability.debts.preGetAccount
						for(let i=0;i<arr2.length;i++){
							if(!arr2[i].preGetTimePlan){
								uni.showToast({
									title: '请补全资产明细——预收账款——收款日期',
									icon: "none",
									duration: 2000
								})
								flag++
								break
							}
							if(!arr2[i].payTimePlan){
								uni.showToast({
									title: '请补全资产明细——预收账款——预计发货时间',
									icon: "none",
									duration: 2000
								})
								flag++
								break
							}
						}
						
						
					}
					
				}
				if (!flag) {
					let that = this
					//判断场景为无的失手是否校验
					if (!getApp().globalData.stdOffsurColonyInfo.colonyCode || !getApp().globalData.stdOffsurColonyInfo
						.partnerCode) {
						that.subForm()
					} else {
						//合作方金额验证/Cim/PartnerManager/oldQuotas
						this.sendRequest({
							url: 'Cim/PartnerManager/oldQuotas',
							method: 'post',
							hideLoading: false,
							data: {
								partnerId: getApp().globalData.stdOffsurColonyInfo.partnerCode,
								colonyNo: getApp().globalData.stdOffsurColonyInfo.colonyCode
							},
							complete: (res) => {
								//console.log(res)
								this.btnDisabled = false
								if (res.code == '200') {
									if (res.data.colonyFlag === 'N') {
										uni.showModal({
											title: '提示',
											content: '该集群已用额度已达90%确定是否继续？',
											cancelText: '取消',
											confirmText: '确定',
											success(subres) {
												if (subres.confirm) {

													if (res.data.partnerFlag === 'N') {
														uni.showModal({
															title: '提示',
															content: '该合作方已用额度已达90%确定是否继续',
															cancelText: '取消',
															confirmText: '确定',
															success(subres2) {
																if (subres2.confirm) {
																	console.log(
																		'集群不符合，合作方不符合')
																	that.subForm()
																}
															}
														})

													} else {
														console.log('集群不符合，合作方符合')
														that.subForm()
													}

												}
											}
										})

									} else {
										if (res.data.partnerFlag === 'N') {
											uni.showModal({
												title: '提示',
												content: '该合作方已用额度已达90%确定是否继续',
												cancelText: '取消',
												confirmText: '确定',
												success(subres2) {
													if (subres2.confirm) {
														console.log('集群符合，合作方不符合')
														that.subForm()
													}
												}
											})

										} else {
											console.log('集群合作方全都符合')
											that.subForm()
										}

									}
								} else {
									uni.showToast({
										title: '合作方校验失败，请重试！',
										icon: "none",
										duration: 2000
									})
								}
							}
						})

					}
				}
			}

		},
		//数据整合
		FormData(isHc) {

			//新增总计数据
			//合并抵押物/房产
			getApp().globalData.stdOffsurCollateral.dyws = [
				...getApp().globalData.stdOffsurCollateral01,
				...getApp().globalData.stdOffsurCollateral02,
				...getApp().globalData.stdOffsurCollateral03,
				...getApp().globalData.stdOffsurCollateral04
			]

			//合并上下游企业stdOffsurIndustryUpdown
			getApp().globalData.stdOffsurIndustryUpdown = [...getApp().globalData.shangyou01, ...getApp().globalData
				.xiayou01,
				...getApp().globalData.shangyou02, ...getApp().globalData.xiayou02
			]

			//抵押物开关控制
			if (getApp().globalData.stdOffsurBaiscInfo.recAssFlag == true || getApp().globalData.stdOffsurBaiscInfo
				.recAssFlag ==
				'true') {
				getApp().globalData.stdOffsurBaiscInfo.recAssFlag = 'true'
			} else {
				getApp().globalData.stdOffsurBaiscInfo.recAssFlag = 'false'
			}

			//关联企业开关控制
			let stdOffsurSceneLoanRelation = JSON.parse(JSON.stringify(getApp().globalData.stdOffsurSceneLoanRelation))
			stdOffsurSceneLoanRelation.map((item) => {
				item.assEntFlag = item.assEntFlag + ''
			})
			getApp().globalData.stdOffsurSceneLoanRelation = stdOffsurSceneLoanRelation

			//场景类 海吉星数据控制
			let sceneType = getApp().globalData.stdOffsurBaiscInfo.sceneType //场景选择
			let HjxData = []
			if (isHc != 'hc' && sceneType != 2) {
				HjxData = []
			} else {
				HjxData = getApp().globalData.stdOffsurSceneHjx
			}
			getApp().globalData.stdOffsurColonyInfo.loginName = getApp().globalData.userId

			if (this.type == 1) {
				return {
					//total:getApp().globalData.total,
					stdOffsurJyFinance:getApp().globalData.stdOffsurJyFinance,
					stdOffsurGnrContract: getApp().globalData.stdOffsurGnrContract,
					stdOffsurAssetLiability:getApp().globalData.stdOffsurAssetLiability,
					stdOffsurCoBorrowerBasic:getApp().globalData.stdOffsurCoBorrowerBasic,
					stdOffsurColonyInfo: getApp().globalData.stdOffsurColonyInfo,
					stdOffsurCollateralContract: getApp().globalData.stdOffsurCollateralContract,
					stdOffsursDelete: getApp().globalData.stdOffsursDelete,
					stdOffsurBankStatement: getApp().globalData.stdOffsurBankStatement,
					stdOffsurBaiscInfo: getApp().globalData.stdOffsurBaiscInfo,
					stdOffsurCars: getApp().globalData.stdOffsurCars,
					stdOffsurCollateral: getApp().globalData.stdOffsurCollateral,
					stdOffsurCommonFinancial: getApp().globalData.stdOffsurCommonFinancial,
					stdOffsurConstruction: getApp().globalData.stdOffsurConstruction,
					stdOffsurConstructionMainCust: getApp().globalData.stdOffsurConstructionMainCust,
					stdOffsurConstructionMargin: getApp().globalData.stdOffsurConstructionMargin,
					stdOffsurConstructionProject: getApp().globalData.stdOffsurConstructionProject,
					stdOffsurEntBasic: getApp().globalData.stdOffsurEntBasic,
					stdOffsurEntRelation: getApp().globalData.stdOffsurEntRelation,
					stdOffsurFinaPay: getApp().globalData.stdOffsurFinaPay,
					stdOffsurIndBasic: getApp().globalData.stdOffsurIndBasic,
					stdOffsurIndRelation: getApp().globalData.stdOffsurIndRelation,
					stdOffsurIndustryTurnover: getApp().globalData.stdOffsurIndustryTurnover,
					stdOffsurIndustryUpdown: getApp().globalData.stdOffsurIndustryUpdown,
					stdOffsurLoanBasic: getApp().globalData.stdOffsurLoanBasic,
					stdOffsurLoanCost: getApp().globalData.stdOffsurLoanCost,
					stdOffsurProcuct: getApp().globalData.stdOffsurProcuct,
					stdOffsurProcuctInfo: getApp().globalData.stdOffsurProcuctInfo,
					stdOffsurProcuctMargin: getApp().globalData.stdOffsurProcuctMargin,
					stdOffsurSceneHjx: HjxData,
					stdOffsurSceneLoanRelation: getApp().globalData.stdOffsurSceneLoanRelation,
					stdOffsurSceneTruck: getApp().globalData.stdOffsurSceneTruck,
					stdOffsurSceneTruckDetail: getApp().globalData.stdOffsurSceneTruckDetail,
					stdOffsurSceneYst: getApp().globalData.stdOffsurSceneYst,
					stdOffsurService: getApp().globalData.stdOffsurService,
					stdOffsurShareholder: getApp().globalData.stdOffsurShareholder,
					stdOffsurTraffic: getApp().globalData.stdOffsurTraffic,
					stdOffsurTrafficMainCargo: getApp().globalData.stdOffsurTrafficMainCargo,
					stdOffsurTrafficMargin: getApp().globalData.stdOffsurTrafficMargin,
					stdOffsurTrafficOwner: getApp().globalData.stdOffsurTrafficOwner,
					stdOffsurWholesale: getApp().globalData.stdOffsurWholesale,
					stdOffsurWholesaleGoods: getApp().globalData.stdOffsurWholesaleGoods
				}
			}
		},


	}
}
